<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <!-- 
	<link rel="stylesheet" href="${pageContext.request.contextPath}/cts/css/style.css" type="text/css"/>
	<script type="text/javascript" src="${pageContext.request.contextPath}/cts/js/jquery.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/cts/js/common.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/cts/js/popdiv.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/cts/js/jquery.bgiframe.js"></script>
   -->
	
	<script type="text/javascript">
	   var type = '<s:property value="#request.type"/>';
	   var typeDetail = '<s:property value="#request.typeDetail"/>';
	   
	   // 费用/委托/标签
	   function showSingleFee(id){
	       var url = "cts/findCompanySingleInfo.action?type="+type;
	       url  += "&id="+id;
	       openPopDiv( 'addOrShowData' , url ,  200);
	       $("#addOrShowData").css({"width":"300px"});
	       $("#addOrShowData").find("div[class='popdiv_content']").css({"height":"150px"});
	      
	       var titlePrefix =  (typeof(id) == 'undefined' || id == '') ? "添加" : "修改";
	       var titleLast = "";
	       if(type == 'item'){
	          titleLast = "作业项目";
	       }else if(type == 'fee'){
	          titleLast = "费用";
	       }else if(type == 'tag'){
	          titleLast = "标签";
	       }
	       
	       var titile = titlePrefix + titleLast;
	       $("#addOrShowData").find("div[class='popdiv_handle']").text(titile);
	   }
	   
	   function orderData(){
	     window.open("cts/findDataDicationaryList.action?toOrder=true&type=<s:property value="#request.type"/>&typeDetail=<s:property value="#request.typeDetail"/>");
	   }
	   
	   // 费用/委托/标签
	   function delSingleFee(id){
	       if(!confirm("您确要进行此操作")){
		        return;
		      }
		      
	       var url = "cts/delCompanySingleInfo.action?type="+type;
	       url  += "&id="+id;
	       $.post(url,"",function(data){
	          if(data == 1){
	            alert("操用成功");
	            window.location.reload();
	          }else if(data == 2){
	            alert("此数据已被引用");
	          }else{
	            alert("操作失败");
	          }
	       });
	   }
	   
	   // 文档
	   function delDocTemplate(id){
	     if(!confirm("您确要进行此操作")){
		        return;
		      }
		      
	       var url = "cts/delDocTemp?id="+id;
	       $.post(url , "" , function(data){
	           if(data == 1){
	              alert("删除成功!");
	              window.location.reload();
	           }else if(data == 2){
	              alert("文档模板已被引用!");
	           }else{
	              alert("删除失败!");
	           }
	       });
	   }
         
         
       // 数据安典    
       function changeUrl(typeDetail){
          var type= '<s:property value="#request.type"/>';
          window.location.href = "${pageContext.request.contextPath}/cts/findDataDicationaryList?type="+type+"&typeDetail="+typeDetail;
       }
       
       // 数据安典
       function changeUrlc11(type){
          window.location.href = "${pageContext.request.contextPath}/cts/findDataDicationaryList?type="+type+"&typeDetail=1";;
       }
        
       function toMoudel(url){
          window.location.href = url;
       }
	</script>
	
	<STYLE type="text/css">
	  #datacon table tr td{
	    height:30px;
	  }
	  
	  .selectBtn{
	     border:none;
	     padding:5px 10px 5px 10px;
	     background-color:gray;
	     float:left;
	     color:#ffffff;
	     font-weight: bold;
	     font-size:10px;
	  }
	  
	  .noselectBtn{
	     border:none;
	     padding:5px 10px 5px 10px;
	     background-color:#ececec;
	     float:left;
	     font-size:10px;
	  }
	  
  	  .mainselectBtn{
	     border:none;
	     padding:5px 10px 5px 10px;
	     background-color:gray;
	     color:#ffffff;
	     font-weight: bold;
	     margin-top:10px;
	     margin-right:10px;
	  }
	  
	  .mainnoselectBtn{
	     border:none;
	     padding:5px 10px 5px 10px;
	     background-color:#dddddd;
	     margin-top:10px;
	     margin-right:10px;
	  }
	</STYLE>
  </head>
  
  <body>
  
<form id="allFromPage" method="post" action="">
    <div align="center">
       <div id="datacon" style="width:773px;margin-top:-4px;">
        <s:if test="#request.type == 'item' ">
           <table style="font-size:12px;width:95%;margin-top:20px;margin-bottom: 20px;text-align:center;" border="0" cellpadding="0" cellspacing="0">
              <tr>
                 <td>&nbsp;</td>
	             <td colspan="4" align="right">
	                <a href="javascript:showSingleFee('')">
	                   <div class="btn_ok">添加</div>
	                </a>
	             </td>
	          </tr>
	          <tr>
	             <td colspan="5" align="right">
	                  名称：<input id="keyword" name="keyword" value="<s:property value="keyword"/>" style="width:100px;"/>
	              &nbsp;&nbsp;    
	                 <select id="searchtype" name="searchtype" style="display:none;">
	                   <option id="" value="">全部</option>
		               <option id="6" value="6">货物加工</option>
		               <option id="7" value="7">文件处理</option>
		               <option id="8" value="8">短途运输</option>
	                </select> 
	                &nbsp;&nbsp;
	                   状态：<select id="searchstatus" name="searchstatus">
	                   <option id="" value="">全部</option>
		               <option id="0" value="0">正常</option>
		               <option id="1" value="1">禁用</option>
	                </select>
	                &nbsp;&nbsp;
	                <input type="button" value="查询" onclick="getParam(1)"/>
	             </td>
	          </tr>
	          <tr class="trChNodeBg">
	            <td class="td1 td0" style="width:30%;">名称</td>
	            <td class="td2 td0" style="width:30%;display:none;">项目类型</td>
	            <td class="td2 td0" style="width:30%;">状态</td>
	            <!-- 
	            <td class="td2 td0" style="width:30%;">相关费用</td>
	             -->
	            <td class="td2 td0" style="width:10%;">操作</td>
	          </tr>
	          <s:iterator value="#request.list" status="sta">
	             <tr <s:if test="#sta.index%2!=0 ">class="clBg"</s:if><s:else>class="clBg2"</s:else>>
		            <td class="td1"><s:property value="name"/>&nbsp;</td>
		            <td class="td2"  style="display:none;">
		               <s:if test="type == 5">卡车运输</s:if>
		               <s:elseif test="type == 6">货物加工</s:elseif>
		               <s:elseif test="type == 7">文件处理</s:elseif>
		               <s:elseif test="type == 8">短途运输</s:elseif>
		               &nbsp;
		            </td>
		            <td class="td2">
		               <s:if test="status == 0">正常</s:if>
		               <s:else>禁用</s:else>
		            </td>
		            <td class="td2"  width="30%">
		                <a href="javascript:showSingleFee('<s:property value="id"/>')">修改</a> | <a href="javascript:stopToUsing('<s:property value="id"/>' , '<s:property value="#request.type"/>')">禁用</a>
		            </td>
		          </tr>
	          </s:iterator>
	        </table>
        </s:if>
        
        <s:elseif test="#request.type == 'fee'">
           <table style="font-size:12px;width:95%;margin-top:20px;margin-bottom: 20px;text-align:center;" border="0" cellpadding="0" cellspacing="0">
	          <tr>
	             <td >&nbsp;</td>
	             <td colspan="3" align="right" style="border:none;">
	                <a href="javascript:showSingleFee('')">
	                   <div class="btn_ok">添加</div>
	                </a>
	             </td>
	          </tr>
	            <tr>
	             <td colspan="4" align="right">
	                名称：<input id="keyword" name="keyword" value="<s:property value="keyword"/>" style="width:100px;"/>
	                &nbsp;&nbsp;    
	                状态：<select id="searchstatus" name="searchstatus">
	                   <option id="" value="">全部</option>
		               <option id="0" value="0">正常</option>
		               <option id="1" value="1">禁用</option>
	                </select>
	                &nbsp;&nbsp;
	                <input type="button" value="查询" onclick="getParam(1)"/>
	             </td>
	          </tr>
	          <tr class="trChNodeBg">
	            <td class="td1 td0">名称</td>
	            <td class="td2 td0">作业名称</td>
	            <td class="td2 td0">是否启用</td>
	            <td class="td2 td0">操作</td>
	          </tr>
	          <s:iterator value="#request.list" status="sta">
	             <tr <s:if test="#sta.index%2!=0 ">class="clBg"</s:if><s:else>class="clBg2"</s:else>>
		            <td class="td1" width="30%"><s:property value="name"/>&nbsp;</td>
		            <td class="td2" width="30%"><s:property value="item.name"/>&nbsp;</td>
		            <td class="td2"width="20%" style="text-align:center;">
		               <s:if test="status == 0">正常</s:if>
		               <s:else>禁用</s:else>
		            </td>
		            <td class="td2" width="30%">
		                <a href="javascript:showSingleFee('<s:property value="id"/>')">修改</a> | <a href="javascript:stopToUsing('<s:property value="id"/>' , '<s:property value="#request.type"/>')">禁用</a>
		            </td>
		         </tr>
	          </s:iterator>
	        </table>
        </s:elseif>
        <s:elseif test="#request.type == 'tag'">
           <table  style="font-size:12px;width:95%;margin-top:20px;margin-bottom: 20px;text-align:center;" border="0" cellpadding="0" cellspacing="0">
	          <tr>
	             <td style="border:none;">&nbsp;</td>
	             <td colspan="2" align="right" style="border:none;">
	                <a href="javascript:showSingleFee('')">
	                    <div class="btn_ok">添加</div>
	                </a>
	             </td>
	          </tr>
	          <tr>
	             <td colspan="5" align="right">
	                  名称：<input id="keyword" name="keyword" value="<s:property value="keyword"/>" style="width:100px;"/>
	                  &nbsp;&nbsp;    
	                  状态：<select id="searchstatus" name="searchstatus">
	                   <option id="" value="">全部</option>
		               <option id="0" value="0">正常</option>
		               <option id="1" value="1">禁用</option>
	                </select>
	                &nbsp;&nbsp;
	                <input type="button" value="查询" onclick="getParam(1)"/>
	             </td>
	          </tr>
	          <tr class="trChNodeBg">
	            <td class="td1 td0">名称</td>
	            <td class="td2 td0">是否启用</td>
	            <td class="td2 td0">操作</td>
	          </tr>
	          <s:iterator value="#request.list" status="sta">
	              <tr <s:if test="#sta.index%2!=0 ">class="clBg"</s:if><s:else>class="clBg2"</s:else>>
	                <td class="td1"><s:property value="name"/>&nbsp;</td>
	                <td class="td2">
		               <s:if test="status == 0">正常</s:if>
		               <s:else>禁用</s:else>
		               &nbsp;
		            </td>
	                <td class="td2" width="35%">
	                   <a href="javascript:showSingleFee('<s:property value="id"/>')">修改</a> | <a href="javascript:stopToUsing('<s:property value="id"/>' , '<s:property value="#request.type"/>')">禁用</a>
	                </td>
		         </tr>
	          </s:iterator>
	        </table>
        </s:elseif>
        <s:elseif test="#request.type == 'file'">
           <table  style="font-size:12px;width:95%;margin-top:20px;margin-bottom: 20px;text-align:center;" border="0" cellpadding="0" cellspacing="0">
	          <tr>
	             <td style="border:none;">&nbsp;</td>
	             <td colspan="2" align="right" style="border:none;">
	                <a href="${pageContext.request.contextPath}/cts/findSingleDocTemp">
	                    <div class="btn_ok">添加</div>
	                </a>
	             </td>
	          </tr>
	           <tr>
	             <td colspan="5" align="right">
	                                         名称：<input id="keyword" name="keyword" value="<s:property value="keyword"/>" style="width:100px;"/>
	                &nbsp;&nbsp;    
	                                         状态：<select id="searchstatus" name="searchstatus">
	                   <option id="" value="">全部</option>
		               <option id="0" value="0">正常</option>
		               <option id="1" value="1">禁用</option>
	                </select>
	                &nbsp;&nbsp;
	                <input type="button" value="查询" onclick="getParam(1)"/>
	             </td>
	          </tr>
	          <tr class="trChNodeBg">
	            <td class="td1 td0">模板名</td>
	            <td class="td2 td0">是否启用</td>
	            <td class="td2 td0">操作</td>
	          </tr>
	          <s:iterator value="#request.list" status="sta">
	             <tr <s:if test="#sta.index%2!=0 ">class="clBg"</s:if><s:else>class="clBg2"</s:else>>
	                <td class="td1"><s:property value="name"/>&nbsp;</td>
	                <td class="td2">
		               <s:if test="status == 0">正常</s:if>
		               <s:else>禁用</s:else>
		               &nbsp;
		            </td>
	                <td width="35%" class="td2">
	                   <a href="${pageContext.request.contextPath}/cts/findSingleDocTemp?id=<s:property value="id"/>">修改</a> | <a href="javascript:delDocTemplate('<s:property value="id"/>')">删除</a>
	                </td>
		         </tr>
	          </s:iterator>
	        </table>
        </s:elseif>
        
			<jsp:include page="pageForm.jsp"></jsp:include>
			<input type="hidden" id="urlforward"  value="" />
			<div id="pagination" valign="middle" class="pagination" ></div>
     </div>
    </div>
        
</form>
        
	<div id="addOrShowData" name="n_addOrShowData" class="popdiv_inner" style="width:500px;">
		<div class="popdiv_inner_outter"></div>
		<div class="popdiv_close"></div>
		<div class="popdiv_handle" title="鼠标左键按住可拖动">用户登录</div>
		<div class="popdiv_content" style="height:300px;text-align: center;">top:200</div>
	</div>
  </body>
</html>


<script type="text/javascript">
	function getParam(istype) {
	    $("#pageSize").val( $("#pageSize").val());
	    var pageNumberS = $("#pageNumber").val();
	    if(parseInt(pageNumberS) <= 0 || istype == 1){
	    	pageNumberS = '1';
	    }
	    $("#pageNumber").val(pageNumberS);
	    submitForm('<s:property value="#request.type"/>');
	}		    
	
	paginationCommon(1);
</script>
